package cn.iocoder.yudao.module.member.dal.mysql.major;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.major.MajorDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.major.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 专业 Mapper
 *
 * @author Alan
 */
@Mapper
public interface MajorMapper extends BaseMapperX<MajorDO> {

    default PageResult<MajorDO> selectPage(MajorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MajorDO>()
                .eqIfPresent(MajorDO::getPid, reqVO.getPid())
                .likeIfPresent(MajorDO::getName, reqVO.getName())
                .eqIfPresent(MajorDO::getCode, reqVO.getCode())
                .eqIfPresent(MajorDO::getCounterpartEnterprises, reqVO.getCounterpartEnterprises())
                .eqIfPresent(MajorDO::getCorrespondingPositions, reqVO.getCorrespondingPositions())
                .eqIfPresent(MajorDO::getProfessionalIntroduction, reqVO.getProfessionalIntroduction())
                .eqIfPresent(MajorDO::getEmploymentDirection, reqVO.getEmploymentDirection())
                .betweenIfPresent(MajorDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(MajorDO::getHasChild, reqVO.getHasChild())
                .orderByDesc(MajorDO::getId));
    }

    List<MajorRespVO> getMajorList(@Param("name") String name);
}